home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / HyperCard Files / Library Hyper Card Templates / Open Stack / Circulation / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1987-12-04  |  12.0 KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in</name>
  5.     <id>-1</id>
  6.     <cardCount>2</cardCount>
  7.     <cardID>3290</cardID>
  8.     <listID>2134</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>---------------------- Open StackΓäó Copyright 1987-----------------------
  17. ---------------------- by the Walking Shadow Press ---------------------
  18. on startUp
  19. getHomeInfo
  20. global fieldScript,fieldList,bookNumber,autoNumbering
  21. global tentativeBook, initGlobals
  22. ------------------------------------------------------------------
  23. --  fieldScript is a global which contains the script that is   --
  24. --  automatically loaded into each newly created field.         --
  25. --  The field must be named at the time of creation in order    --
  26. --  for fieldScript to be loaded into its script.  Otherwise,   --
  27. --  errors result.                                              --
  28. --                                                              --
  29. --                                                              --
  30. --  The following put commands put the generic field script     --
  31. --  into global fieldScript.                                    --
  32. ------------------------------------------------------------------
  33. put empty into fieldScript
  34. put "on closeField" into line 1 of fieldScript
  35. put "global fieldList" into line 2 of fieldScript
  36. put "put word 3 of name of me into tempName" into line 3 of ┬¼
  37. fieldScript
  38. put "if not(fieldList contains tempName) then" into line 4 of ┬¼
  39. fieldScript
  40. put "put (word 3 of name of me) & "&quote&","&quote&" after fieldList" ┬¼
  41. into line 5 of fieldScript
  42. put "end if" into line 6 of fieldScript
  43. put "end closeField" into line 7 of fieldScript
  44.  
  45. ---------------------------------------------------------------------
  46. --  fieldList is the global whick keeps track of which fields are  --
  47. --  altered and need to be replicated each time a card is opened   --
  48. --  and then closed.                                               --
  49. ---------------------------------------------------------------------
  50. put empty into fieldList
  51. ---------------------------------------------------------------------
  52. --  tentativeBook is a global which records whether a new card is  --
  53. --  being tentatively numbered, awaiting the entry of book data.   --
  54. ---------------------------------------------------------------------
  55. put false into tentativeBook
  56.  
  57. --------------------------------------------------------------------
  58. -- The automatic book numbering feature uses the globals:         --
  59. -- autoNumbering and bookNumber to record whether autonumbering   --
  60. -- is currently turned on and the next book number, respectively. --
  61. -- They must be initialized on startUp by going to the control    --
  62. -- card and accessing the "Book Number" field and the             --
  63. -- autoNumbering button.                                          --
  64. --------------------------------------------------------------------
  65. set lockScreen to true
  66. push card
  67. put true into initGlobals
  68. go to stack "Control"
  69. put the hilite of button "Auto Numbering" into autoNumbering
  70. put card field "Book Number" into bookNumber
  71. ----------------------------------------------------------------
  72. -- initGlobals records whether the globals have already been  --
  73. -- initialized or not.  Otherwise, upon entry to the control  --
  74. -- card, the "Book Number" field would be set to the current  --
  75. -- value of global bookNumber, which is at first empty.       --
  76. ----------------------------------------------------------------
  77. put false into initGlobals
  78. pop card
  79. set lockScreen to false
  80.  
  81. pass startUp
  82. end startUp
  83.  
  84. on openStack
  85. global beginGlobal
  86. -----------------------------------------------------------------
  87. --  This stack might be opened directly, which means that the  --
  88. --  globals may not be initialized yet.  beginGlobal will      --
  89. --  always be false if the library system is up already.       --
  90. --  Otherwise, a startUp message is send to initialize the     --
  91. --  globals.                                                   --
  92. -----------------------------------------------------------------
  93. if beginGlobal is not false then
  94. put false into beginGlobal
  95. set cursor to 4
  96. startUp
  97. end if
  98. end openStack
  99.  
  100. on quit
  101. global bookNumber
  102. -----------------------------------------------------------
  103. -- on quit we should save the bookNumber global so its   --
  104. -- current value will be available upon startUp later.   --
  105. -- bookNumber is saved in the "Book Number" field on the --
  106. -- conrtol card.                                         --
  107. -----------------------------------------------------------
  108. set lockScreen to true
  109. push card
  110. go to stack "Control"
  111. put bookNumber into card field "Book Number"
  112. pop card
  113. set lockScreen to false
  114. end quit
  115.  
  116. on mkNewCard
  117. global autoNumbering
  118. ---------------------------------------------------------------------
  119. --  This handler coordinates the creation of a new card set        --
  120. --  record.  It does so by going to each of the four main stacks:  --
  121. --  Acquisition, Circulation, Catalog, and Label Setup and         --
  122. --  making a new card on each.                                     --
  123. --      At the same time the cards are made, their id numbers are  --
  124. --  noted and from all four id numbers is created the card script  --
  125. --  which controls the transfer to the related cards of each stack.--
  126. ---------------------------------------------------------------------
  127. set cursor to 4
  128. -- First, we create a new card in the current stack. --
  129. doMenu "New Card"
  130. set lockScreen to true
  131.  
  132. -- We record the id of the newly created card in circId.  --
  133. put the id of this card into circId
  134.  
  135. -------------------------------------------------------------------
  136. -- Next, we create a segment of what will eventually be the      --
  137. -- card script of each new card.  The following segment will     --
  138. -- handle transfers from other stacks to the card just created.  --
  139. -------------------------------------------------------------------
  140. put "on goCirc" into line 1 of goCircScr
  141. put "go to "&circId&" of stack Circulation" into line 2 of goCircScr
  142. put "end goCirc" into line 3 of goCircScr
  143. ---------------------------------------------------------------------
  144. -- We push this card, 'cause we'll be coming back. See the second  --
  145. -- to the last comment in this handler.                            --
  146. ---------------------------------------------------------------------
  147. push card
  148. ---------------------------------------------------------------------
  149. --  We next go to the Acquisition stack and do the same operations --
  150. --  as above, then go to the Catalog stack, and then the Label     --
  151. --  Setup stack below...                                           --
  152. ---------------------------------------------------------------------
  153. go to stack "Acquisitions"
  154. doMenu "New Card"
  155.  
  156. put the id of this card into acqId
  157.  
  158. put "on goAcq" into line 1 of goAcqScr
  159. put "go to "&acqId&" of stack Acquisitions" into line 2 of goAcqScr
  160. put "end goAcq" into line 3 of goAcqScr
  161. push card
  162. ------------------------------------------------------------------
  163. go to stack "Cataloging" -- See last comment.
  164. doMenu "New Card"
  165.  
  166. put the id of this card into catId
  167.  
  168. put "on goCat" into line 1 of goCatScr
  169. put "go to "&catId&" of stack Cataloging" into line 2 of goCatScr
  170. put "end goCat" into line 3 of goCatScr
  171. push card
  172. ------------------------------------------------------------------
  173. go to stack "Labels" -- See last big comment.
  174. doMenu "New Card"
  175.  
  176. put the id of this card into labId
  177.  
  178. put "on goLab" into line 1 of goLabScr
  179. put "go to "&labId&" of stack Labels" into line 2 of goLabScr
  180. put "end goLab" into line 3 of goLabScr
  181. ------------------------------------------------------------------
  182. -- Now, from all the card script segments created above, we     --
  183. -- synthesize a big card script that will handle inter-stack    --
  184. -- transfers.  We combine all the segments into the variable    --
  185. -- cardScr.                                                     --
  186. ------------------------------------------------------------------
  187. put goAcqScr into cardScr
  188. put goCircScr into line 4 of cardScr
  189. put goCatScr into line 7 of cardScr
  190. put goLabScr into line 10 of cardScr
  191.  
  192. -------------------------------------------------------------------
  193. --  Finally, since we've been "pushing" cards as we went along,  --
  194. --  all we do now is retrace our card steps by "popping" and     --
  195. --  set the card scripts of each card we created to the          --
  196. --  synthesized script.                                          --
  197. -------------------------------------------------------------------
  198. set the script of this card to cardScr
  199. pop card
  200. set the script of this card to cardScr
  201. pop card
  202. set the script of this card to cardScr
  203. pop card
  204. set the script of this card to cardScr
  205.  
  206. --------------------------------------------------------------------
  207. --  Look at the openCard handler in the background script.  You   --
  208. --  will notice that the auto-numbering function is deactivated   --
  209. --  if the card's script is emtpy.  This is done to prevent       --
  210. --  autonumbering while the cards are created.                    --
  211. --  Now, however, we want the auto-numbering function to work,    --
  212. --  provided it's been turned on, so we send an openCard          --
  213. --  message to the current card.                                  --
  214. --------------------------------------------------------------------
  215. if autoNumbering is true then send openCard to this card
  216.  
  217. set lockscreen to false
  218. end mkNewCard
  219.  
  220. on delCard
  221. ---------------------------------------------------------------------
  222. --  This handler coordinates the deletion of card sets             --
  223. --  It does so by going to each of the four main stacks:           --
  224. --  Acquisition, Circulation, Catalog, and Label Setup and         --
  225. --  deleting the right card in each.                               --
  226. --  To make sure the right card is deleted, we use the             --
  227. --  go to command that appears in the card script, which is the    --
  228. --  same command that normally transfers to other cards from       --
  229. --  the current one.                                               --
  230. ---------------------------------------------------------------------
  231. if the number of cards >1 then
  232. answer "Delete this and related cards in other stacks?" with ┬¼
  233. "OK" or "Cancel"
  234. if it is not "Cancel" then
  235. set cursor to 4
  236. set lockScreen to true
  237.  
  238. push card
  239. do line 2 of the script of this card -- go to Acquisition
  240. --------------------------------------------------------------
  241. -- Unfortunately, we cannot delete immediately, else        --
  242. -- we lose our way to the other cards, so push this card... --
  243. --------------------------------------------------------------
  244. push card
  245. do line 8 of the script of this card -- go to Catalog
  246. push card -- Push the catalog card too.
  247. do line 11 of the script of this card -- go to Label SetUp
  248. --------------------------------------------------------------
  249. --  Now that we have all the related cards nicely lined     --
  250. --  up in the card id stack, we just delete and pop, delete --
  251. --  and pop ... etc.                                        --
  252. --------------------------------------------------------------
  253. doMenu "Delete Card"
  254. pop card
  255. doMenu "Delete Card"
  256. pop card
  257. doMenu "Delete Card"
  258. pop card
  259. doMenu "Delete Card"
  260.  
  261. set lockscreen to false
  262. end if
  263. else
  264. answer "The last card cannot be deleted."
  265. end if
  266. end delCard
  267.  
  268. on arrowKey whichKey
  269. --------------------------------------------------------------
  270. -- If the keyboard has arrow, we make use of some to go to  --
  271. -- next and previous cards...                               --
  272. --------------------------------------------------------------
  273. if the CommandKey is down then
  274. mkNewCard
  275. else
  276. if whichKey = "right" then
  277. go to next card
  278. else
  279. if whichKey = "left" then
  280. go to prev card
  281. end if
  282. end if
  283. end if
  284. end arrowKey
  285.  
  286. -------------------- End Walking Shadow Library ---------------------
  287.  
  288. on resume
  289. getHomeInfo
  290. pass resume
  291. end resume
  292.  
  293. on getHomeInfo
  294. global stacks,applications,documents,userName
  295. set lockScreen to true
  296. set lockMessages to true
  297. push this card
  298. go to card "User Preferences"